package top.huxy.boot.controller.all;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.huxy.boot.annotation.RequestCD;
import top.huxy.boot.annotation.RequestRemake;
import top.huxy.boot.model.dto.DTOVideoFeedback;
import top.huxy.boot.service.impl.VideoApiServiceImpl;
import top.huxy.boot.util.obj.Result;

/**
 * @Classname VideoController
 * @Description VideoController
 * @Date 2021/9/14 16:47
 * @Created by huxy
 */
@RestController
@RequestMapping("/video")
public class VideoController {

    @Autowired
    VideoApiServiceImpl videoApiService;

    @GetMapping("/getApiList")
    @RequestRemake("获取视频解析API")
    public Result getApiList() {
        return Result.success(videoApiService.getVideoApiList());
    }

    @PostMapping("/feedback")
    @RequestCD(time = 1000 * 10)
    public Result feedback(DTOVideoFeedback feedback) {
        String msg = videoApiService.feedback(feedback);
        if (msg == null) {
            return Result.success("感谢你的反馈");
        } else {
            return Result.clientError(msg);
        }
    }
}
